<template>
	<view :style="[{paddingTop:CustomBar+'px'}]">
		<cu-custom bgColor="bg-colorP" :isBack="true">
			<block slot="backText"></block>
			<block slot="content">设置</block>
		</cu-custom>
		<view class="person-content">
			<view class="content">
				<person-cell v-for="(item,index) in menuList" :key="index" :item="item" @navigate="navigate"></person-cell>
			</view>
			<view class="logout bg-colorP" @click="loginout">
				退出登录
			</view>
		</view>
	</view>
</template>

<script>
	import personCell from "./component/person-cell"
	export default {
		components: {
			personCell
		},
		data() {
			return {
				CustomBar: this.CustomBar,
				menuList: [
					// {
					// 	title: '账户与安全',
					// 	icon: '',
					// 	type: 'navigate',
					// 	desc: '',
					// 	typeUrl: ''
					// },
					// {
					// 	title: '收货地址',
					// 	icon: '',
					// 	type: 'navigate',
					// 	desc: '',
					// 	typeUrl: ''
					// },
					{
						title: '用户须知',
						icon: '',
						type: 'navigate',
						desc: '',
						typeUrl: '/pages/userAgree?type=yonghu'
					},
					{
						title: '法律声明',
						icon: '',
						type: 'navigate',
						desc: '',
						typeUrl: '/pages/userAgree?type=falv'
					},
					{
						title: '商户管理规范',
						icon: '',
						type: 'navigate',
						desc: '',
						typeUrl: '/pages/userAgree?type=guanli'
					},
					// {
					// 	title: '关于掌商',
					// 	icon: '',
					// 	type: 'navigate',
					// 	desc: '',
					// 	typeUrl: ''
					// }
				]
			}
		},
		methods: {
			navigate(val) {
				if (!val) return
				uni.navigateTo({
					url: val
				})
			},
			loginout() {
				uni.showModal({
					title: "",
					content: "退出后不会删除任何历史数据，确认退出登录",
					cancelColor: "#f34930",
					confirmText: "退出登录",
					confirmColor: "#666666",
					success: function(res) {
						if (res.confirm) {
							uni.removeStorageSync('userInfo')
							uni.removeStorageSync('auth_token')
							uni.showToast({
								title: '登出成功'
							})
							setTimeout(function() {
								uni.navigateBack({
									delta: 1
								});
							}, 1500)
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}

				})
			}
		},

	}
</script>

<style>
	page {
		background: #fff;
	}

	.person-content {
		width: 100%;
		box-sizing: border-box;
	}

	.person-content .content {
		border-radius: 8rpx;
		width: 100%;
		display: flex;
		flex-direction: column;
		background: #fff;
	}

	.person-content .content .item:last-child .show {
		border-bottom: none;
	}

	.logout {
		width: 700rpx;
		height: 88rpx;
		text-align: center;
		line-height: 88rpx;
		color: #fff;
		/* margin: 15px auto; */
		border-radius: 8rpx;
		position: fixed;
		bottom: 20rpx;
		left: 50%;
		margin-left: -350rpx;
	}
</style>
